home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Ghost 1.0 / source / Ghost ƒ / Ghost code / ghost challenge.c next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.2 KB  |  86 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        ghost challenge.c
  4.  
  5. Purpose:    This module handles one player challenging another --
  6.             look up the word and see who's right.
  7.  
  8.  
  9. Ghost -=- a classic word-building challenge
  10. Copyright (C) 1993 Mark Pilgrim
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "ghost globals.h"
  30. #include "ghost challenge.h"
  31. #include "ghost strategy.h"
  32. #include "ghost end.h"
  33. #include "msg graphics.h"
  34. #include "msg timing.h"
  35. #include "msg sounds.h"
  36.  
  37. void ChallengeWord(void)
  38. {
  39.     int                iconIndex;
  40.     Boolean            isFemale;
  41.     
  42.     gStatus=kIsChallenging;
  43.     UpdateBoard();
  44.     gStatus=kNoStatus;
  45.     
  46.     StartTiming();
  47.     if (FindOneOccurrence())
  48.     {
  49.         BlockMove(thisWord, gTheWord, 256);
  50.         TimeCorrection(1+30*gGameSpeed);
  51.         StartTiming();
  52.         gStatus=kLostChallenge;
  53.         UpdateBoard();
  54.         gStatus=kNoStatus;
  55.         DoSound(sound_raz, FALSE);
  56.         TimeCorrection(60+30*gGameSpeed);
  57.         StartTiming();
  58.         NextPlayer();
  59.     }
  60.     else
  61.     {
  62.         TimeCorrection(1+30*gGameSpeed);
  63.         StartTiming();
  64.         gStatus=kWonChallenge;
  65.         UpdateBoard();
  66.         gStatus=kNoStatus;
  67.         TimeCorrection(1+30*gGameSpeed);
  68.         if (gPlayOrderIndex[gCurrentPlayer]>=gNumHumanPlayers)
  69.         {
  70.             iconIndex=gComputerIconIndex[gPlayOrderIndex[gCurrentPlayer]-gNumHumanPlayers];
  71.             isFemale=((iconIndex==0) || (iconIndex==2) || (iconIndex==22));
  72.         }
  73.         else isFemale=FALSE;
  74.         
  75.         if (isFemale)
  76.             DoSound(sound_female_drat, FALSE);
  77.         else
  78.             DoSound(sound_male_drat, FALSE);
  79.         
  80.         StartTiming();
  81.         GoToPreviousPlayer();
  82.         EndRound();
  83.         NextPlayer();
  84.     }
  85. }
  86.